import java.io.IOException;
import java.nio.file.DirectoryIteratorException;
import java.nio.file.DirectoryStream;
import java.nio.file.FileStore;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;


public class arq5 {

	public static void main(String args[]) throws IOException{
		
		Iterable<Path> dir = FileSystems.getDefault().getRootDirectories();
		for(Path path: dir){
			System.out.println(dir+"\n");
		}
		
		Path tmp = Paths.get("/home/greg");
		try(DirectoryStream<Path> stream = Files.newDirectoryStream(tmp)){
			
			for(Path ptmp: stream){
				System.out.println(ptmp);
			}
			
		}catch(IOException | DirectoryIteratorException e){
			e.printStackTrace();
		}
		
		FileSystem fs = FileSystems.getDefault();
		for(FileStore store : fs.getFileStores()){
			System.out.println("Unidade: "+store.toString());
			System.out.println("Total: "+store.getTotalSpace());
			System.out.println("Disponivel: "+store.getUsableSpace());
			System.out.println("Utilizado: "+(store.getTotalSpace() - store.getUsableSpace()));
			
		}
		
	}
}
